perm filename FUNCT.FAI[GEM,MUS] blob sn#123629 filedate 1976-11-14 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	entry FUNCT,DUMMY.
C00005 ENDMK
C⊗;
entry FUNCT,DUMMY.
title FUNCT
subttl FUNCT - FORTRAN to SAIL interface for minimization routines
internal FUNCT,DUMMY.
external SFUNCT
comment ⊗
	This is a FORTRAN callable routine that looks like this:

FUNCT(N,ARG,VAL,GRAD)

Where N is the number of parameters, ARG is an array of those parameters,
VAL is a real number representing the error term, and GRAD is the
gradient of the error term.

This routine calls the SAIL routine SFUNCT:

EXTERNAL PROCEDURE SFUNCT(INTEGER N; REAL ARRAY ARG;
	REFERENCE REAL VAL; REFERENCE REAL ARRAY GRAD);

Which actually computes all those things
⊗

pln←←100
array pdl[pln],spdl[pln],acs[20]

ac1←1
ac2←2
ac3←3
sp←16
p←17

FUNCT:	0			; AC 16 gets dumped here
	movem 17,acs+17
	movei 17,acs
	blt 17,acs+16		; Dump the accumulators

	move p,[iowd pln,pdl]	; Put up a stack
	hrrz ac1,@(16)		; Pick up number of dimensions
	push p,ac1
	hrrz ac1,1(16)		; Pick up address of parameter array
	push p,ac1
	hrrz ac1,2(16)		; Pick up address of error term
	push p,ac1
	hrrz ac1,3(16)		; and address of gradient vector
	push p,ac1
	move sp,[iowd pln,spdl]	; Get a string stack too
	pushj p,sfunct

	movsi 17,acs
	blt 17,17
	jra 16,4(16)		; Return to loser

DUMMY.:	jfcl
	outstr [asciz /
Ho Ho Ho! Somebody called DUMMY.!
/]
	jrst 4,.

end